#include "G4RunManager.hh"
#include "G4UImanager.hh"

#include "globals.hh"
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "DetectorConstruction.hh"
#include "PhysicsList.hh"
#include "PrimariesGenerator.hh"

#include "Randomize.hh"

#include "G4VisExecutive.hh"

#include "G4UIExecutive.hh"

int main(int argc,char** argv)
{
	G4RunManager* runManager = new G4RunManager();
	DetectorConstruction *detector = new DetectorConstruction();
	runManager->SetUserInitialization(detector);
	G4VUserPhysicsList *physics = new PhysicsList();
	runManager-> SetUserInitialization(physics);
	G4VUserPrimaryGeneratorAction* gen_action = new PrimariesGenerator(1);
	runManager->SetUserAction(gen_action);
	runManager->Initialize();

	/*
	G4VisManager* visManager = new G4VisExecutive();
	visManager->Initialize();
	*/


	G4UImanager* UI = G4UImanager::GetUIpointer();
	UI->ApplyCommand("/run/verbose 0");
	UI->ApplyCommand("/event/verbose 0");
	UI->ApplyCommand("/tracking/verbose 0");

	runManager->BeamOn(10000);

	/*
	UI->ApplyCommand("/control/execute vis.mac");
	G4UIExecutive* ui = new G4UIExecutive(argc, argv);
	ui->SessionStart();



	G4UIsession * session = new G4UIterminal;
	session->SessionStart();

	//delete session;
	//delete ui;
	//delete UI;
	delete visManager;

	//runManager->BeamOn(100);*/
	delete runManager;
	return 0;
}
